
numbers = input("请输入一组逗号分隔的数字：") # 从 input 获得的任何东西都是字符串，或者说是一个字符列表
print(type(numbers))
# "1,2,3,4"
numbers = numbers.split(',') # 默认情况下，split 用空格11
numbers = [int(n) for n in numbers]

print(numbers)

# result = []

# for n in numbers:
#     if n % 2 == 0:
#         result.append(n)
# 基于原始列表生成满足条件的新列表
# result = [n for n in numbers if n % 2 == 0]

# print(result)

# odds = [n for n in numbers if n % 2 != 0]

# doubles = [n * 2 for n in numbers]

# print(doubles)

